package com.zx.mes;

import com.spring4all.swagger.EnableSwagger2Doc;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.netflix.feign.EnableFeignClients;
import org.springframework.cloud.netflix.hystrix.dashboard.EnableHystrixDashboard;

/**
 * 起动入口
 * rest api 权限处理
 * https://spring.io/blog/2015/03/08/getting-started-with-activiti-and-spring-boot
 * http://www.huguiqi.com/2017/11/13/springboot-activiti/
 * http://www.mossle.com/docs/activiti/index.html#configuration 这是关键
 * @author hyl
 * @date 2018-1-24
 */
@EnableSwagger2Doc
@EnableDiscoveryClient
@EnableFeignClients
@EnableCircuitBreaker
@EnableHystrixDashboard
@SpringBootApplication
public class ActivitiApplication
{
    public static void main( String[] args )
    {
        SpringApplication.run(ActivitiApplication.class, args);
    }
//    @Bean
//    InitializingBean usersAndGroupsInitializer(final IdentityService identityService) {
//
//        return () -> {
//
//            Group group = identityService.newGroup("user");
//            group.setName("users");
//            group.setType("security-role");
//            identityService.saveGroup(group);
//
//            User admin = identityService.newUser("admin");
//            admin.setPassword("123456");
//            identityService.saveUser(admin);
//
//        };
//    }

//    @Bean
//    public RestAuthenticator restAuthenticator(){
//        return new RestAuthenticator() {
//            @Override
//            public boolean requestRequiresAuthentication(HttpServletRequest request) {
//                return false;
//            }
//
//            @Override
//            public boolean isRequestAuthorized(HttpServletRequest request) {
//                return false;
//            }
//        };
//    }
}
